/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.UserMemberLevelPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.IUserMemberLevelMapper;

@Service
public class UserMemberLevelService {
	@Autowired
	private IUserMemberLevelMapper userMemberLevelMapper;
	
	/**
	 * 根据ID获取UserMemberLevelPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return UserMemberLevelPo
	 */
	public UserMemberLevelPo getUserMemberLevel(int id) {
		return userMemberLevelMapper.findUserMemberLevelById(id);
	}
	
	/**
	 * 根据条件获取UserMemberLevelPo对象，并返回查询的数据总数
	 * 
	 * @param userMemberLevel
	 * @Author 迷蝶
	 * @return ResultPageTo<UserMemberLevelPo>
	 */
	public ResultPageTo<UserMemberLevelPo> getUserMemberLevels(UserMemberLevelPo userMemberLevel) {
		return new ResultPageTo<UserMemberLevelPo>(userMemberLevel.getStart(), userMemberLevel.getSize(), 
				userMemberLevelMapper.findUserMemberLevelCount(userMemberLevel), userMemberLevelMapper.findUserMemberLevels(userMemberLevel));
	}
	
	/**
	 * 根据ID删除UserMemberLevelPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delUserMemberLevel(int id) {
		return userMemberLevelMapper.delUserMemberLevelById(id);
	}
	
	/**
	 * 增加UserMemberLevelPo对象
	 * 
	 * @param userMemberLevel
	 * @Author 迷蝶
	 */
	public Integer addUserMemberLevel(UserMemberLevelPo userMemberLevel) {
		return userMemberLevelMapper.addUserMemberLevel(userMemberLevel);
	}
	
	/**
	 * 根据条件更新UserMemberLevelPo对象
	 * 
	 * @param userMemberLevel
	 * @Author 迷蝶
	 */
	public Integer updateUserMemberLevel(UserMemberLevelPo userMemberLevel) {
		return userMemberLevelMapper.updateUserMemberLevel(userMemberLevel);
	}
	
}
